<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // 数组转map 结构
    // 1. 二维数组 转 map (key-value)
    var fn = function () { };
    var arr = [1, 2, 3];
    var o = { a: 1, b: 2 };
    var reg = /\s/ig;

    var list = [[100, 200], ["hello", "world"], [true, true], [null, null], [fn, fn], [arr, arr], [o, o], [reg, reg]];

    var m = new Map();
    list.forEach(item => { // [100,200]
        var [key, val] = item;
        m.set(key, val);
    })
    console.log(m);

    // 简单
    var m = new Map(list);
    console.log(m);


    // map结构转数组
    var arr = [...m];
    console.log(arr);

</script>

</html>